#include "stdafx.h"

#define BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS
#include <boost/graph/graphviz.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/properties.hpp>

using namespace boost;

// Vertex properties
typedef property <vertex_name_t, std::string,
            property <vertex_color_t, float > > vertex_p;  
// Edge properties
typedef property < edge_weight_t, double > edge_p;
// Graph properties
typedef property < graph_name_t, std::string > graph_p;
// adjacency_list-based type
typedef adjacency_list < vecS, vecS, directedS,
  vertex_p, edge_p, graph_p > graph_t;

void main()
{
  // Construct an empty graph and prepare the dynamic_property_maps.
  graph_t graph(0);
  dynamic_properties dp;

  property_map<graph_t, boost::vertex_name_t>::type name =
    get(vertex_name, graph);
  dp.property("node_id",name);

  property_map<graph_t, boost::vertex_color_t>::type mass =
    get(vertex_color, graph);
  dp.property("mass",mass);

  property_map<graph_t, boost::edge_weight_t>::type weight =
    get(edge_weight, graph);
  dp.property("weight",weight);

  // Use ref_property_map to turn a graph property into a property map
  boost::ref_property_map<graph_t*,std::string> 
    gname(get_property(graph,graph_name));
  dp.property("name",gname);

  std::fstream ifile;
  ifile.open("input.dot",std::ios::in);		 

  bool status = read_graphviz(ifile,graph,dp,"node_id");

  ifile.close();

	boost::graph_traits<graph_t>::vertex_iterator vi, vi_end;

  tie(vi, vi_end) = vertices(graph); 
	for(boost::graph_traits<graph_t>::vertex_iterator i = vi; i != vi_end; i++)
  {
  }

  std::fstream ofile;
	ofile.open("output.dot",std::ios::out);		 
	write_graphviz(ofile, graph);
	write_graphviz(std::cout, graph);
	ofile.close();
}

